package com.moyingren.springcloud.config;

import org.bouncycastle.util.encoders.Base64;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import java.nio.charset.Charset;

@Configuration
public class RestConfig {
    @Bean(name = "header1")
    public HttpHeaders httpHeaders() {
        HttpHeaders httpHeaders = new HttpHeaders();
        String auth = "admin:123456";

//        byte[] encodedAuth = Base64.encode(auth.getBytes(Charset.forName("US-ASCII")));
//        String authHeader = "Basic" + new String(encodedAuth);
//
//
////        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
////        String authHeader = "Basic " + bCryptPasswordEncoder.encode(auth);
//
//        httpHeaders.set("Authorization", authHeader);
        httpHeaders.set("Test1", "123456");
        return httpHeaders;
    }
}
